
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>dom结构</title>
		<script>
			function getEle(){
				var d=document.getElementById("slogo");
				// console.log(d.nextSibling);
				// console.log(d.nextSibling.nodeType);
				// while(d.nextSibling.nodeType!=1){
				// 	d=d.nextSibling;
				// }
				// d.nextSibling.innerHTML="教育改变生活";
				d.nextElementSibling.innerHTML="教育改变生活";
				d.previousElementSibling.innerHTML="Old Li is not at work";
				
				d.parentNode.style.border="3px solid red";
			}
		</script>
	</head>
	<body>
		<div>
			<h2>老李今天请假了。。。</h2>
			<p id="slogo">好好学习，天天向上</p>
			<div>
				We change lives
			</div>
		</div>
		<input type="button" value="通过元素的位置获得其他元素" onclick="getEle()"/>
	</body>
</html>
